import AvatarImg from "../public/img/avatar.png"

interface AvatarProps {
    src?: string | undefined | null,
    radius: number,
    onClick?: () => void
}

const Avatar = (props: AvatarProps) => {
    let src = AvatarImg;
    if (props.src) src = props.src;

    return (
        <img src={src} alt={"图片无法显示"}
             width={props.radius}
             height={props.radius}
             style={{
                 borderRadius: "50%"
             }}
             onClick={props.onClick}
        />
    );
}

export default Avatar;
